/**
 * Created by dukes on 2016/3/2.
 */
class GuildApply extends eui.Component {
    public constructor() {
        super();
        this.skinName = "skins.scene.GuildApplySkin";
        this.addEventListener(egret.Event.ADDED_TO_STAGE,this.onAdded, this );
    }
    private onAdded(evt:egret.Event){
        window["__applyList"]();
    }
    public onApplyList(list){
        this.provider.source = list;
    }
    public onBroadApply(data){
        if( this.provider && this.provider.source && this.provider.source.length != 0){
            this.provider.source.push(data);
        }
    }
    private provider:eui.ArrayCollection;
    public apply_list:eui.List;
    public partAdded(name:string, instance:any) {
        super.partAdded(name, instance);
        if (name == "apply_list") {
            this.apply_list = instance;
            this.apply_list.itemRenderer = GuildApplyItemRender;
            this.provider = new eui.ArrayCollection();
            this.apply_list.dataProvider = this.provider;
        }
    }
    private static _instance:GuildApply;
    public static getInstance():GuildApply{
        if( GuildApply._instance == null)
            GuildApply._instance = new GuildApply();
        return GuildApply._instance;
    }
}